/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  						       mouse_window.cpp

	$Header: /game/mouse_window.cpp $

	$NoKeywords: $

 ************************************************************************/

// kill the 255+ character identifier warning.  Templates tend to exceed that easily.
#include "precompiled.h"
#pragma warning( disable: 4786 )

#include "mouse_window.h"

// ------------------------------------------------------------------
// window for a bitmap-based mouse
// ------------------------------------------------------------------
t_mouse_window::t_mouse_window( t_screen_point hot_spot )
              : t_window( k_completely_transparent, 0 )
{
	m_hot_spot = hot_spot;
	set_cursor( 0 );
}

t_mouse_window::~t_mouse_window()
{
}
// ------------------------------------------------------------------
// window for a bitmap-based mouse
// ------------------------------------------------------------------
bool t_mouse_window::is_contained( t_screen_point point ) const
{
	return false;
}

// ------------------------------------------------------------------
// window for a bitmap-based mouse
// open for display
// ------------------------------------------------------------------
void t_mouse_window::open()
{
	t_window::open( get_screen_rect(), get_main_window() );
}


// ------------------------------------------------------------------
// window for a bitmap-based mouse
// on adding child, expand to include child's extents.
// ------------------------------------------------------------------
void t_mouse_window::add_child( t_window* window )
{
	t_window::add_child( window );

	t_screen_rect rect = get_screen_rect();

	if (rect.height() == 0)
		rect = window->get_screen_rect();
	else
		rect = get_extent( rect, window->get_screen_rect() );

	// change window's size.
	move_screen_rect( rect, false );
}
